package april.test_4_8;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class TestMain1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Set<String> set = new HashSet<>();
        int max = 0;
        String string = scanner.nextLine();
        for (int i = 0; i < n; i++) {
            String str1 = scanner.next();
            String str2 = scanner.next();
            if(str2.equals("connect")) {
                set.add(str1);
                int size = set.size();
                max = Math.max(size,max);
            } else {
                if(set.contains(str1)) {
                    set.remove(str1);
                }
            }
        }
        System.out.println(max);
    }
}
